home *** CD-ROM | disk | FTP | other *** search
/ 3D Game Programming All in One / 3D Game Programming All in One Disc.iso / 3D2E / RESOURCES / KOOB / common / client / actionMap.cs next >
Text File  |  2005-11-23  |  1KB  |  44 lines

  1. //-----------------------------------------------------------------------------
  2. // Torque Game Engine 
  3. // Copyright (C) GarageGames.com, Inc.
  4. //-----------------------------------------------------------------------------
  5.  
  6. //------------------------------------------------------------------------------
  7. // Utility remap functions:
  8. //------------------------------------------------------------------------------
  9.  
  10. function ActionMap::copyBind( %this, %otherMap, %command )
  11. {
  12.    if ( !isObject( %otherMap ) )
  13.    {
  14.       error( "ActionMap::copyBind - \"" @ %otherMap @ "\" is not an object!" );
  15.       return;
  16.    }
  17.  
  18.    %bind = %otherMap.getBinding( %command );
  19.    if ( %bind !$= "" )
  20.    {
  21.       %device = getField( %bind, 0 );
  22.       %action = getField( %bind, 1 );
  23.       %flags = %otherMap.isInverted( %device, %action ) ? "SDI" : "SD";
  24.       %deadZone = %otherMap.getDeadZone( %device, %action );
  25.       %scale = %otherMap.getScale( %device, %action );
  26.       %this.bind( %device, %action, %flags, %deadZone, %scale, %command );
  27.    }
  28. }
  29.  
  30. //------------------------------------------------------------------------------
  31. function ActionMap::blockBind( %this, %otherMap, %command )
  32. {
  33.    if ( !isObject( %otherMap ) )
  34.    {
  35.       error( "ActionMap::blockBind - \"" @ %otherMap @ "\" is not an object!" );
  36.       return;
  37.    }
  38.  
  39.    %bind = %otherMap.getBinding( %command );
  40.    if ( %bind !$= "" )
  41.       %this.bind( getField( %bind, 0 ), getField( %bind, 1 ), "" );
  42. }
  43.  
  44.